<template>
  <div id="repulseDetail">
    <p
      style="
        height: 50px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid #d2d2d2;
        color: #007aff;
      "
    >
      <span style="margin-right: 10px" class="line"></span>
      申请信息
    </p>
    <div class="formStyle" v-for="(item, index) in formData" :key="index">
      <span style="color: #ff0000">*</span>
      <van-field v-model="rowData[item.value]" :label="item.name" />
    </div>
    <p style="height: 50px; display: flex; align-items: center; color: #007aff">
      <span style="margin-right: 10px" class="line"></span>

      审批意见
    </p>
    <p style="height: 50px; display: flex; align-items: center">
      打回意见：
      {{ option }}
    </p>
    <p style="height: 50px; display: flex; align-items: center">打回理由</p>
    <van-cell-group inset>
      <van-field
        readonly
        v-model="message"
        rows="3"
        autosize
        label=""
        type="textarea"
        placeholder="打回理由"
        style="border: 1px solid #ccc"
      />
    </van-cell-group>
    <div class="bottomBtn">
      <el-button type="primary" @click="nextSep('ruleForm')">下一步</el-button>
    </div>
  </div>
</template>

<script>
import { FileServerProxy } from "@/utils/api";
export default {
  name: "repulseDetail",
  data() {
    return {
      message: "",
      rowData: {},
      option: "",
      DHLYID: "",
      formData: [
        {
          name: "户主姓名",
          value: "HOUSEAPPLICANT",
        },
        {
          name: "身份证号码",
          value: "CERTIFICATECODE",
        },
        {
          name: "手机号",
          value: "APPLYPHONE",
        },
        {
          name: "所属市",
          value: "S",
        },
        {
          name: "所属县(区)",
          value: "X",
        },
        {
          name: "所属镇",
          value: "TOWN",
        },
        {
          name: "所属村",
          value: "CUN",
        },
        {
          name: "建房类型",
          value: "BUILDTYPE",
        },
        {
          name: "建房理由",
          value: "BUILDREASON",
        },
        {
          name: "是否联建",
          value: "IF_LJF",
        },
      ],
    };
  },
  methods: {
    nextSep() {
      //判断打回理由是资料不全的，提交村预审环节
      if (this.DHLYID == "437") {
        let paerEx = {
          procName: "up_TUIHUI",
          dtParams: JSON.stringify([
            {
              I_USERID: this.rowData.PKID,
              I_TYPE: 2,
            },
          ]),
          token: window.localStorage.getItem("token"),
        };
        let procNamesEX = {
          accessCode: "69db6bece3a7480592e2ec753d1e335e",

          cityCode: window.localStorage.getItem("citycode")
            ? window.localStorage.getItem("citycode")
            : "441300000000",
          params: paerEx,
        };
        FileServerProxy(procNamesEX);
      } else {
        //结束
        let paerExjs = {
          procName: "up_TUIHUI",
          dtParams: JSON.stringify([
            {
              I_USERID: this.rowData.PKID,
              I_TYPE: 1,
            },
          ]),
          token: window.localStorage.getItem("token"),
        };
        let procNamesEXjs = {
          accessCode: "69db6bece3a7480592e2ec753d1e335e",

          cityCode: window.localStorage.getItem("citycode")
            ? window.localStorage.getItem("citycode")
            : "441300000000",
          params: paerExjs,
        };
        FileServerProxy(procNamesEXjs);
      }
      //返回首页
      setTimeout(() => {
        this.$router.push({
          path: '/ZLJIndex',
        });
      }, 500);
    },
  },
  mounted() {
    ;
    this.rowData = JSON.parse(this.$route.query.data);
    this.option = this.rowData.OPINION;
    this.message = this.rowData.DHLY;
    this.DHLYID = this.rowData.DHLYID;
  },
};
</script>

<style scoped lang="scss">
#repulseDetail {
  height: 90vh;
  overflow: auto;
  padding: 10px;
  .line {
    width: 6px;
    height: 26px;
    background: #007aff;
    display: inline-block;
  }
  .formStyle {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #d2d2d2;
  }
  .bottomBtn {
    position: fixed;
    bottom: 0%;
    left: 0%;
    height: 50px;
    width: 100%;
    background: #007aff;
    line-height: 50px;
    text-align: center;
    color: #ffffff;
    font-weight: bold;
    margin-top: 20px;
  }
}
</style>
